/*
 * 
 * 
 * @author: Oren Zamir
 */
package org.valire.usermanagement.services;

import java.util.List;

import org.valire.usermanagement.beans.Role;
import org.valire.usermanagement.beans.User;


/**
 * The Interface RolesService.
 */
public interface RolesService {

	/**
	 * Creates the roles.
	 *
	 * @param role the role
	 * @return the roles
	 */
	public Role createRole(Role role);
	
	/**
	 * Removes the role.
	 *
	 * @param role the role
	 * @return the roles
	 */
	public void removeRole(Role role);
	
	/**
	 * Gets the all roles.
	 *
	 * @return the all roles
	 */
	public List<Role> getAllRoles();	
	
	/**
	 * Gets the method roles.
	 *
	 * @param method the method
	 * @return the method roles
	 */
	List<Role> getMethodRoles(String method);

	/**
	 * Check method access.
	 *
	 * @param user the user
	 * @param method the method
	 * @return true, if successful
	 */
	boolean checkMethodAccessForRole(User user,String method);

	
	/**
	 * Update role.
	 *
	 * @param role the role
	 */
	void updateRole(Role role);
	
	/**
	 * Gets the role with the given name.
	 * 
	 * @param roleName
	 * @return
	 */
	Role getRole(String roleName);	
}
